(*
  Brook for Free Pascal

  Copyright (C) 2014-2019 Silvio Clecio

  See the file LICENSE.txt, included in this distribution,
  for details about the copyright.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*)

{ HTTP consts unit. }

unit BrookHttpConsts;

{$i brook.inc}

interface

uses
  BrookConsts;

const
  { - 1xx: Informational - Request received, continuing process }
  { }
  BROOK_HTTP_STATUS_CODE_CONTINUE = 100;
  BROOK_HTTP_STATUS_CODE_SWITCHING_PROTOCOLS = 101;
  { - 2xx: Success - The action was successfully received, understood, and accepted }
  { }
  BROOK_HTTP_STATUS_CODE_OK = 200;
  BROOK_HTTP_STATUS_CODE_CREATED = 201;
  BROOK_HTTP_STATUS_CODE_ACCEPTED = 202;
  BROOK_HTTP_STATUS_CODE_NON_AUTHORITATIVE_INFORMATION = 203;
  BROOK_HTTP_STATUS_CODE_NO_CONTENT = 204;
  BROOK_HTTP_STATUS_CODE_RESET_CONTENT = 205;
  BROOK_HTTP_STATUS_CODE_PARTIAL_CONTENT = 206;
  { - 3xx: Redirection - Further action must be taken in order to complete the request }
  { }
  BROOK_HTTP_STATUS_CODE_MULTIPLE_CHOICES = 300;
  BROOK_HTTP_STATUS_CODE_MOVED_PERMANENTLY = 301;
  BROOK_HTTP_STATUS_CODE_FOUND = 302;
  BROOK_HTTP_STATUS_CODE_SEE_OTHER = 303;
  BROOK_HTTP_STATUS_CODE_NOT_MODIFIED = 304;
  BROOK_HTTP_STATUS_CODE_USE_PROXY = 305;
  BROOK_HTTP_STATUS_CODE_TEMPORARY_REDIRECT = 307;
  { - 4xx: Client Error - The request contains bad syntax or cannot be fulfilled }
  { }
  BROOK_HTTP_STATUS_CODE_BAD_REQUEST = 400;
  BROOK_HTTP_STATUS_CODE_UNAUTHORIZED = 401;
  BROOK_HTTP_STATUS_CODE_PAYMENT_REQUIRED = 402;
  BROOK_HTTP_STATUS_CODE_FORBIDDEN = 403;
  BROOK_HTTP_STATUS_CODE_NOT_FOUND = 404;
  BROOK_HTTP_STATUS_CODE_METHOD_NOT_ALLOWED = 405;
  BROOK_HTTP_STATUS_CODE_NOT_ACCEPTABLE = 406;
  BROOK_HTTP_STATUS_CODE_PROXY_AUTHENTICATION_REQUIRED = 407;
  BROOK_HTTP_STATUS_CODE_REQUEST_TIMEOUT = 408;
  BROOK_HTTP_STATUS_CODE_CONFLICT = 409;
  BROOK_HTTP_STATUS_CODE_GONE = 410;
  BROOK_HTTP_STATUS_CODE_LENGTH_REQUIRED = 411;
  BROOK_HTTP_STATUS_CODE_PRECONDITION_FAILED = 412;
  BROOK_HTTP_STATUS_CODE_REQUEST_ENTITY_TOO_LARGE = 413;
  BROOK_HTTP_STATUS_CODE_REQUEST_URI_TOO_LONG = 414;
  BROOK_HTTP_STATUS_CODE_UNSUPPORTED_MEDIA_TYPE = 415;
  BROOK_HTTP_STATUS_CODE_REQUESTED_RANGE_NOT_SATISFIABLE = 416;
  BROOK_HTTP_STATUS_CODE_EXPECTATION_FAILED = 417;
  { - 5xx: Server Error - The server failed to fulfill an apparently valid request }
  { }
  BROOK_HTTP_STATUS_CODE_INTERNAL_SERVER_ERROR = 500;
  BROOK_HTTP_STATUS_CODE_NOT_IMPLEMENTED = 501;
  BROOK_HTTP_STATUS_CODE_BAD_GATEWAY = 502;
  BROOK_HTTP_STATUS_CODE_SERVICE_UNAVAILABLE = 503;
  BROOK_HTTP_STATUS_CODE_GATEWAY_TIMEOUT = 504;
  BROOK_HTTP_STATUS_CODE_HTTP_VERSION_NOT_SUPPORTED = 505;
  { - 1xx: Informational - Request received, continuing process }
  { }
  BROOK_HTTP_REASON_PHRASE_CONTINUE = 'Continue';
  BROOK_HTTP_REASON_PHRASE_SWITCHING_PROTOCOLS = 'Switching Protocols';
  { - 2xx: Success - The action was successfully received, understood, and accepted }
  { }
  BROOK_HTTP_REASON_PHRASE_OK = 'OK';
  BROOK_HTTP_REASON_PHRASE_CREATED = 'Created';
  BROOK_HTTP_REASON_PHRASE_ACCEPTED = 'Accepted';
  BROOK_HTTP_REASON_PHRASE_NON_AUTHORITATIVE_INFORMATION = 'Non-Authoritative Information';
  BROOK_HTTP_REASON_PHRASE_NO_CONTENT = 'No Content';
  BROOK_HTTP_REASON_PHRASE_RESET_CONTENT = 'Reset Content';
  BROOK_HTTP_REASON_PHRASE_PARTIAL_CONTENT = 'Partial Content';
  { - 3xx: Redirection - Further action must be taken in order to complete the request }
  { }
  BROOK_HTTP_REASON_PHRASE_MULTIPLE_CHOICES = 'Multiple Choices';
  BROOK_HTTP_REASON_PHRASE_MOVED_PERMANENTLY = 'Moved Permanently';
  BROOK_HTTP_REASON_PHRASE_FOUND = 'Found';
  BROOK_HTTP_REASON_PHRASE_SEE_OTHER = 'See Other';
  BROOK_HTTP_REASON_PHRASE_NOT_MODIFIED = 'Not Modified';
  BROOK_HTTP_REASON_PHRASE_USE_PROXY = 'Use Proxy';
  // 10.3.7 306 (Unused)
  // The 306 status code was used in a previous version of the specification,
  // is no longer used, and the code is reserved.
  { }
  BROOK_HTTP_REASON_PHRASE_TEMPORARY_REDIRECT = 'Temporary Redirect';
  { - 4xx: Client Error - The request contains bad syntax or cannot be fulfilled }
  { }
  BROOK_HTTP_REASON_PHRASE_BAD_REQUEST = 'Bad Request';
  BROOK_HTTP_REASON_PHRASE_UNAUTHORIZED = 'Unauthorized';
  BROOK_HTTP_REASON_PHRASE_PAYMENT_REQUIRED = 'Payment Required';
  BROOK_HTTP_REASON_PHRASE_FORBIDDEN = 'Forbidden';
  BROOK_HTTP_REASON_PHRASE_NOT_FOUND = 'Not Found';
  BROOK_HTTP_REASON_PHRASE_METHOD_NOT_ALLOWED = 'Method Not Allowed';
  BROOK_HTTP_REASON_PHRASE_NOT_ACCEPTABLE = 'Not Acceptable';
  BROOK_HTTP_REASON_PHRASE_PROXY_AUTHENTICATION_REQUIRED = 'Proxy Authentication Required';
  BROOK_HTTP_REASON_PHRASE_REQUEST_TIMEOUT = 'Request Timeout';
  BROOK_HTTP_REASON_PHRASE_CONFLICT = 'Conflict';
  BROOK_HTTP_REASON_PHRASE_GONE = 'Gone';
  BROOK_HTTP_REASON_PHRASE_LENGTH_REQUIRED = 'Length Required';
  BROOK_HTTP_REASON_PHRASE_PRECONDITION_FAILED = 'Precondition Failed';
  BROOK_HTTP_REASON_PHRASE_REQUEST_ENTITY_TOO_LARGE = 'Request Entity Too Large';
  BROOK_HTTP_REASON_PHRASE_REQUEST_URI_TOO_LONG = 'Request-URI Too Long';
  BROOK_HTTP_REASON_PHRASE_UNSUPPORTED_MEDIA_TYPE = 'Unsupported Media Type';
  BROOK_HTTP_REASON_PHRASE_REQUESTED_RANGE_NOT_SATISFIABLE = 'Requested Range Not Satisfiable';
  BROOK_HTTP_REASON_PHRASE_EXPECTATION_FAILED = 'Expectation Failed';
  { - 5xx: Server Error - The server failed to fulfill an apparently valid request }
  { }
  BROOK_HTTP_REASON_PHRASE_INTERNAL_SERVER_ERROR = 'Internal Server Error';
  BROOK_HTTP_REASON_PHRASE_NOT_IMPLEMENTED = 'Not Implemented';
  BROOK_HTTP_REASON_PHRASE_BAD_GATEWAY = 'Bad Gateway';
  BROOK_HTTP_REASON_PHRASE_SERVICE_UNAVAILABLE = 'Service Unavailable';
  BROOK_HTTP_REASON_PHRASE_GATEWAY_TIMEOUT = 'Gateway Timeout';
  BROOK_HTTP_REASON_PHRASE_HTTP_VERSION_NOT_SUPPORTED = 'HTTP Version Not Supported';
  { All HTTP methods }
  { }
  BROOK_HTTP_REQUEST_METHOD_GET = 'GET';
  BROOK_HTTP_REQUEST_METHOD_POST = 'POST';
  BROOK_HTTP_REQUEST_METHOD_PUT = 'PUT';
  BROOK_HTTP_REQUEST_METHOD_DELETE = 'DELETE';
  BROOK_HTTP_REQUEST_METHOD_HEAD = 'HEAD';
  BROOK_HTTP_REQUEST_METHOD_OPTIONS = 'OPTIONS';
  BROOK_HTTP_REQUEST_METHOD_PATCH = 'PATCH';
  BROOK_HTTP_REQUEST_METHOD_PROPFIND = 'PROPFIND';
  BROOK_HTTP_REQUEST_METHOD_PROPPATCH = 'PROPPATCH';
  BROOK_HTTP_REQUEST_METHOD_COPY = 'COPY';
  BROOK_HTTP_REQUEST_METHOD_MOVE = 'MOVE';
  BROOK_HTTP_REQUEST_METHOD_MKCOL = 'MKCOL';
  BROOK_HTTP_REQUEST_METHOD_TRACE = 'TRACE';
  BROOK_HTTP_REQUEST_METHOD_LOCK = 'LOCK';
  BROOK_HTTP_REQUEST_METHOD_UNLOCK = 'UNLOCK';
  { Some header fields }
  { }
  BROOK_HTTP_HEADER_CACHE_CONTROL = 'Cache-Control';
  BROOK_HTTP_HEADER_CONTENT_DESCRIPTION = 'Content-Description';
  BROOK_HTTP_HEADER_CONTENT_DISPOSITION = 'Content-Disposition';
  BROOK_HTTP_HEADER_ETAG = 'ETag';
  BROOK_HTTP_HEADER_STATUS = 'Status';
  BROOK_HTTP_HEADER_TRANSFER_ENCODING = 'Transfer-Encoding';
  BROOK_HTTP_HEADER_X_POWERED_BY = 'X-Powered-By';
  BROOK_HTTP_HEADER_CHARSET = '; charset=';
  { Some content-types }
  { }
  BROOK_HTTP_CONTENT_TYPE_TEXT_PLAIN = 'text/plain';
  BROOK_HTTP_CONTENT_TYPE_TEXT_HTML = 'text/html';
  BROOK_HTTP_CONTENT_TYPE_TEXT_CSS = 'text/css';
  BROOK_HTTP_CONTENT_TYPE_TEXT_XML = 'text/xml';
  BROOK_HTTP_CONTENT_TYPE_TEXT_CVS = 'text/cvs';
  BROOK_HTTP_CONTENT_TYPE_TEXT_RICHTEXT = 'text/richtext';
  BROOK_HTTP_CONTENT_TYPE_TEXT_RTF = 'text/rtf';
  BROOK_HTTP_CONTENT_TYPE_MULTIPART_FORM_DATA = 'multipart/form-data';
  BROOK_HTTP_CONTENT_TYPE_MULTIPART_FORM_DATA_BOUNDARY = BROOK_HTTP_CONTENT_TYPE_MULTIPART_FORM_DATA + '; boundary=';
  BROOK_HTTP_CONTENT_TYPE_APP_JSON = 'application/json';
  BROOK_HTTP_CONTENT_TYPE_APP_XML = 'application/xml';
  BROOK_HTTP_CONTENT_TYPE_APP_RDF_XML = 'application/rdf+xml';
  BROOK_HTTP_CONTENT_TYPE_APP_X_WWW_FORM_URLENCODED = 'application/x-www-form-urlencoded';
  BROOK_HTTP_CONTENT_TYPE_APP_JAVASCRIPT = 'application/javascript';
  BROOK_HTTP_CONTENT_TYPE_APP_OCTET_STREAM = 'application/octet-stream';
  BROOK_HTTP_CONTENT_TYPE_APP_PDF = 'application/pdf';
  BROOK_HTTP_CONTENT_TYPE_APP_ZIP = 'application/zip';
  BROOK_HTTP_CONTENT_TYPE_APP_MSWORD = 'application/msword';
  BROOK_HTTP_CONTENT_TYPE_APP_MS_EXCEL = 'application/vnd.ms-excel';
  BROOK_HTTP_CONTENT_TYPE_APP_MS_POWERPOINT = 'application/vnd.ms-powerpoint';
  BROOK_HTTP_CONTENT_TYPE_APP_MP4 = 'application/mp4';
  BROOK_HTTP_CONTENT_TYPE_APP_MPEG4_GENERIC = 'application/mpeg4-generic';
  BROOK_HTTP_CONTENT_TYPE_IMAGE_PNG = 'image/png';
  BROOK_HTTP_CONTENT_TYPE_IMAGE_JPEG = 'image/jpeg';
  BROOK_HTTP_CONTENT_TYPE_IMAGE_GIF = 'image/gif';
  BROOK_HTTP_CONTENT_TYPE_IMAGE_TIFF = 'image/tiff';
  BROOK_HTTP_CONTENT_TYPE_AUDIO_MPEG = 'audio/mpeg';
  BROOK_HTTP_CONTENT_TYPE_VIDEO_MPEG = 'video/mpeg';
  BROOK_HTTP_CONTENT_TYPE_VIDEO_QUICKTIME = 'video/quicktime';
  { Cache-Control directives }
  { }
  BROOK_HTTP_CACHE_CONTROL_NO_CACHE = 'no-cache';
  BROOK_HTTP_CACHE_CONTROL_NO_STORE = 'no-store';
  BROOK_HTTP_CACHE_CONTROL_MAX_AGE = 'max-age=';
  BROOK_HTTP_CACHE_CONTROL_MAX_STALE = 'max-stale';
  BROOK_HTTP_CACHE_CONTROL_MIN_FRESH = 'min-fresh';
  BROOK_HTTP_CACHE_CONTROL_NO_TRANSFORM = 'no-transform';
  BROOK_HTTP_CACHE_CONTROL_ONLY_IF_CACHED = 'only-if-cached';
  BROOK_HTTP_CACHE_CONTROL_CACHE_EXTENSION = 'cache-extension';
  BROOK_HTTP_CACHE_CONTROL_PUBLIC = 'public';
  BROOK_HTTP_CACHE_CONTROL_PRIVATE = 'private';
  BROOK_HTTP_CACHE_CONTROL_MUST_REVALIDATE = 'must-revalidate';
  BROOK_HTTP_CACHE_CONTROL_PROXY_REVALIDATE = 'proxy-revalidate';
  BROOK_HTTP_CACHE_CONTROL_S_MAXAGE = 's-maxage';
  { Disposition types }
  { }
  BROOK_HTTP_CONTENT_DISPOSITION_INLINE = 'inline';
  BROOK_HTTP_CONTENT_DISPOSITION_ATTACHMENT = 'attachment';
  { Content encoding }
  { }
  BROOK_HTTP_CONTENT_ENCODING_DEFLATE = 'deflate';
  BROOK_HTTP_CONTENT_ENCODING_GZIP = 'gzip';
  BROOK_HTTP_CONTENT_ENCODING_SDCH = 'sdch';
  BROOK_HTTP_CONTENT_ENCODING_X_GZIP = 'x-gzip';
  { Transfer encoding }
  { }
  BROOK_HTTP_TRANSFER_ENCODING_CHUNKED = 'chunked';
  { Some charsets }
  { }
  BROOK_HTTP_CHARSET_ISO_8859_1 = 'iso-8859-1';
  BROOK_HTTP_CHARSET_UTF_8 = 'utf-8';
  { Server environment variables. }
  { }
  BROOK_SRV_ENV_DOCUMENT_ROOT = 'DOCUMENT_ROOT';
  BROOK_SRV_ENV_SERVER_ADDR = 'SERVER_ADDR';
  BROOK_SRV_ENV_SERVER_ADMIN = 'SERVER_ADMIN';
  BROOK_SRV_ENV_SERVER_SOFTWARE = 'SERVER_SOFTWARE';
  BROOK_SRV_ENV_SERVER_NAME = 'SERVER_NAME';
  BROOK_SRV_ENV_GATEWAY_INTERFACE = 'GATEWAY_INTERFACE';
  BROOK_SRV_ENV_SERVER_PROTOCOL = 'SERVER_PROTOCOL';
  BROOK_SRV_ENV_SERVER_PORT = 'SERVER_PORT';
  BROOK_SRV_ENV_REQUEST_METHOD = 'REQUEST_METHOD';
  BROOK_SRV_ENV_REQUEST_URI = 'REQUEST_URI';
  BROOK_SRV_ENV_PATH_INFO = 'PATH_INFO';
  BROOK_SRV_ENV_PATH_TRANSLATED = 'PATH_TRANSLATED';
  BROOK_SRV_ENV_SCRIPT_FILENAME = 'SCRIPT_FILENAME';
  BROOK_SRV_ENV_SCRIPT_NAME = 'SCRIPT_NAME';
  BROOK_SRV_ENV_QUERY_STRING = 'QUERY_STRING';
  BROOK_SRV_ENV_REMOTE_HOST = 'REMOTE_HOST';
  BROOK_SRV_ENV_REMOTE_ADDR = 'REMOTE_ADDR';
  BROOK_SRV_ENV_REMOTE_PORT = 'REMOTE_PORT';
  BROOK_SRV_ENV_AUTH_TYPE = 'AUTH_TYPE';
  BROOK_SRV_ENV_REMOTE_USER = 'REMOTE_USER';
  BROOK_SRV_ENV_REMOTE_IDENT = 'REMOTE_IDENT';
  BROOK_SRV_ENV_CONTENT_TYPE = 'CONTENT_TYPE';
  BROOK_SRV_ENV_CONTENT_LENGTH = 'CONTENT_LENGTH';
  BROOK_SRV_ENV_X_FORWARDED_FOR = 'X_FORWARDED_FOR';
  { Client environment variables. }
  { }
  BROOK_CLT_ENV_HTTP_COOKIE = 'HTTP_COOKIE';
  BROOK_CLT_ENV_HTTP_REFERER = 'HTTP_REFERER';
  BROOK_CLT_ENV_HTTP_USER_AGENT = 'HTTP_USER_AGENT';
  BROOK_CLT_ENV_HTTP_IF_MODIFIED_SINCE = 'HTTP_IF_MODIFIED_SINCE';
  BROOK_CLT_ENV_HTTP_HOST = 'HTTP_HOST';
  BROOK_CLT_ENV_HTTP_CONNECTION = 'HTTP_CONNECTION';
  BROOK_CLT_ENV_HTTP_CACHE_CONTROL = 'HTTP_CACHE_CONTROL';
  BROOK_CLT_ENV_HTTP_ACCEPT = 'HTTP_ACCEPT';
  BROOK_CLT_ENV_HTTP_ACCEPT_ENCODING = 'HTTP_ACCEPT_ENCODING';
  BROOK_CLT_ENV_HTTP_ACCEPT_LANGUAGE = 'HTTP_ACCEPT_LANGUAGE';
  BROOK_CLT_ENV_HTTP_ACCEPT_CHARSET = 'HTTP_ACCEPT_CHARSET';
  BROOK_CLT_ENV_HTTP_IF_NONE_MATCH = 'HTTP_IF_NONE_MATCH';
  BROOK_CLT_ENV_HTTP_X_REQUESTED_WITH = 'HTTP_X_REQUESTED_WITH';
  { Default response templates. }
  { }
  BROOK_HTTP_RESPONSE_TEMPLATE_NOT_FOUND =
    '<html><head><title>Page not found</title></head><body>' +
    '<h1>404 - Page not found</h1></body></html>';
  BROOK_HTTP_RESPONSE_TEMPLATE_INTERNAL_SERVER_ERROR =
    '<html><head><title>Internal server error</title></head><body>' +
    '<h1>500 - Internal server error</h1>' +
    '<p style="color: red;" >@error</p>' +
    '</body></html>';

var
  BROOK_HTTP_CLIENT_DEFAULT_LIBRARY: string = ES;

implementation

end.
